/*
1,会变色的背景，鼠标滑进滑出响应区域则背景会变化
这个要用的时候是由子类继承,然后指定不同的动画,这么写就是代码比较统一，免得到处都是代码
这个现在默认是背景变色的
*/
package kgame5.kgui.kcomp {
import flash.display.*;
import flash.events.*;

public class SmartBG{
	
	//________________Propetry____________________
	private var 
		mc_EA:MovieClip,//响应事件的区域
		mc_bg:MovieClip;//执行动画的区域 
		
	private var 
		pane_bg_alpha_out:Number=0.5,//鼠标在外
		pane_bg_alpha_over:Number=0.65;//鼠标进入
	//________________Method______________________
	public function SmartBG(p_mc_EA:MovieClip,p_mc_bg:MovieClip,alpha_out:Number=0.5,alpha_over:Number=0.65){
		mc_EA=p_mc_EA;
		mc_bg=p_mc_bg;
		
		pane_bg_alpha_out=alpha_out;
		pane_bg_alpha_over=alpha_over;
		
		mc_bg.alpha=pane_bg_alpha_out;//最开始是显示鼠标在外的alpha
		
		mc_EA.addEventListener(MouseEvent.ROLL_OVER, moverh);
		mc_EA.addEventListener(MouseEvent.ROLL_OUT, mouth);
	}
	
	//如果需要不同的动画可以写子类去继承这个
	protected function moverh(e:MouseEvent){
		mc_bg.alpha=pane_bg_alpha_over;//PANE_BG_ALPHA_OVER;
	}
	protected function mouth(e:MouseEvent){
		mc_bg.alpha=pane_bg_alpha_out;//PANE_BG_ALPHA_OUT;
	}
}//end of class
}